﻿<hi:Common_WapHeader runat="server" />
<input type="hidden" runat="server" id="hidden_skus" clientidmode="Static" />

<div class="slides-collect-btn">
    <a id="addF" href="javascript:AddFavorite();" class=""><span class="glyphicon glyphicon-heart-empty">
    </span></a><a id="addedF" href="javascript:;" class="hide"><span class="glyphicon glyphicon-heart">
    </span></a>
</div>
<div id="slides">
    <hi:WapTemplatedRepeater id="rptProductImages" templatefile="/Tags/skin-Common_Slide.ascx"
        runat="server" />
</div>
<div class="pbox bgColor-white">
    <div class="goods-info">
        <div class="name font-xl">
            <asp:literal runat="server" id="litProdcutName" />
        </div>
        <div class="intro text-muted">
            <asp:literal runat="server" id="litShortDescription" />
        </div>
        <div class="price font-l">
            ¥<span id="spSalaPrice"><asp:literal runat="server" id="litSalePrice" /></span><del class="text-muted font-s">¥<asp:literal
                runat="server" id="litMarketPrice" /></del><span class="text-muted font-m">已售<asp:literal
                    runat="server" id="litSoldCount" />件</span></div>
    </div>
</div>
<div class="specification-box">
    <hi:common_skuselector id="skuSelector" runat="server" />
    <div class="buy-num">
        <div class="text-muted">
            购买数量</div>
        <div class="list clearfix">
            <div class="goods-num">
                <div id="spSub" class="shopcart-add">
                    <span class="glyphicon glyphicon-minus-sign"></span>
                </div>
                <input type="tel" id="buyNum" class="form-control" value="1" />
                <div id="spAdd" class="shopcart-minus">
                    <span class="glyphicon glyphicon-plus-sign"></span>
                </div>
                <div class="info font-s text-muted">
                    （剩余可购买数量：<span id="spStock"><asp:literal runat="server" id="litStock" /></span>件）</div>
            </div>
        </div>
    </div>
</div>
<div class="goods-detail pbox bgColor-white btns-fixed-padding">
    <div class="panel panel-default">
        <div class="panel-heading">
            属性
        </div>
        <table class="table" id="attrtable">
            <tbody>
                <hi:common_expandattributes id="ExpandAttributes" runat="server" />
            </tbody>
        </table>
    </div>
    <div class="list-group">
        <a href="javascript:;" class="list-group-item" onclick="javascript:location.href='ProductConsultations.aspx'+location.search;">
            商品咨询 <span class="badge-h">
                <asp:literal runat="server" id="litConsultationsCount" />
            </span></a><a href="javascript:;" class="list-group-item" onclick="javascript:location.href='ProductReview.aspx'+location.search;">
                商品评价 <span class="badge-h">
                    <asp:literal runat="server" id="litReviewsCount" />
                </span></a>
    </div>
    
    <asp:literal runat="server" id="litDescription" />
</div>
<div class="btns-fixed">
    <button id="addcartButton" type="shoppingBtn" onclick="AddProductToCart()" class="btn btn-warning">
        加入购物车</button>
    <button id="buyButton" type="shoppingBtn" class="btn btn-danger">
        立刻购买</button>
</div>
<input type="hidden" runat="server" clientidmode="Static" id="litHasCollected" />
<script type="text/javascript">

    $(function () {

        var slidesImg = $('#slides img');
        var width = 650, height = 650;
        if (slidesImg.length > 1) {
            $('#slides').slidesjs({
                width: width,
                height: height,
                play: {
                    active: true,
                    auto: true,
                    interval: 4000,
                    swap: true
                }
            });
            $(".slidesjs-play, .slidesjs-stop, .slidesjs-previous, .slidesjs-next").remove();
        }
        else {

            $('#slides').css('display','block').html('<div style="width:100%;"><a href="javascript:;"></a></div>');
            $('#slides div a').append(slidesImg);
        }
    });


    function getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]); return null;
    }

    function AddFavorite() {
        var data = {};
        data.ProductId = getQueryString("productId");

        $.post("/api/VshopProcess.ashx?action=AddFavorite", data, function (json) {
            if (json.success === true) {
                $("#imgFavorite").hide().css('display', 'block').addClass('select');
                $('#addF').addClass('hide');
                $('#addedF').removeClass('hide');
                alert_h('收藏成功！');

            }
            else {
                alert_h('您当前还没有登录！', function () {
                    location.replace('/wapshop/MyFavorites.aspx?returnUrl=/wapshop/ProductDetails.aspx?productId=' + getParam('productId'));
                });
            }
        });
    }

    $(function () {
        var data = {};
        data.ProductId = getQueryString("productId");

        $.post("/api/VshopProcess.ashx?action=CheckFavorite", data, function (json) {
            if (json.success === true) {
                $("#imgFavorite").hide().css('display', 'block').addClass('select');

            }
        });

        if ($('#litHasCollected').val() == "1") {
            $('#addF').addClass('hide');
            $('#addedF').removeClass('hide');
        }

        //包含多个规格时，首先禁用购买和加入购物车按钮
        if ($(".SKUValueClass").length > 0)
            disableShoppingBtn(true);
    })
    if ($("#attrtable tr").length <= 0) {
        $("#attrtable").parent().hide();
    }
</script>
<script src="http://res.juseshop.com/utility/vproduct.helper.js" type="application/javascript"> </script>
<script src="/script/swipe.js"></script>
<hi:Common_WapFooter runat="server" />

